package com.matongxue.ioc2;

import com.matongxue.ioc.User;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class IocTest2 {

    public static void main(String[] args) {

       //spring容器 ApplicationContext map
        //ioc 反射框架使用 对象的创建交给spring, 对象创建不需要自己创建，直接从spring获取
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");
        Object bean1 = applicationContext.getBean("user2");
        System.out.println(bean1);

        Object bean2 = applicationContext.getBean("user2");
        System.out.println(bean2);

        System.out.println(bean1==bean2);

    }
}
